package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.EnumSet;

/**
 * Created by LN on 2017/12/5
 */
@Entity
@Table(name = "group_buying_base")
public class GroupBuyingBaseEntity extends BaseEntity{
    public enum GroupBuyingBaseEntity_{
        endDatetime,startDatetime,captainPrice,teammatePrice
    }

    private String name;
    private String code;
    private Date startDatetime;
    private Date endDatetime;
    private Integer duration;
    private String goodCode;
    private Integer numMember;
    private BigDecimal captainPrice;
    private BigDecimal teammatePrice;
    private String content;
    private String descript;
    private String descriptM;
    private String logo;
    private String isAutoRefund;

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "start_datetime")
    public Date getStartDatetime() {
        return startDatetime;
    }

    public void setStartDatetime(Date startDatetime) {
        this.startDatetime = startDatetime;
    }

    @Basic
    @Column(name = "end_datetime")
    public Date getEndDatetime() {
        return endDatetime;
    }

    public void setEndDatetime(Date endDatetime) {
        this.endDatetime = endDatetime;
    }

    @Basic
    @Column(name = "duration")
    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    @Basic
    @Column(name = "good_code")
    public String getGoodCode() {
        return goodCode;
    }

    public void setGoodCode(String goodCode) {
        this.goodCode = goodCode;
    }

    @Basic
    @Column(name = "num_member")
    public Integer getNumMember() {
        return numMember;
    }

    public void setNumMember(Integer numMember) {
        this.numMember = numMember;
    }


    @Basic
    @Column(name = "captain_price")
    public BigDecimal getCaptainPrice() {
        return captainPrice;
    }

    public void setCaptainPrice(BigDecimal captainPrice) {
        this.captainPrice = captainPrice;
    }

    @Basic
    @Column(name = "teammate_price")
    public BigDecimal getTeammatePrice() {
        return teammatePrice;
    }

    public void setTeammatePrice(BigDecimal teammatePrice) {
        this.teammatePrice = teammatePrice;
    }

    @Basic
    @Column(name = "content")
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
    @Basic
    @Column(name = "descript", nullable = true, length = -1)
    public String getDescript() {
        return descript;
    }

    public void setDescript(String descript) {
        this.descript = descript;
    }

    @Basic
    @Column(name = "descript_m", nullable = true, length = -1)
    public String getDescriptM() {
        return descriptM;
    }

    public void setDescriptM(String descriptM) {
        this.descriptM = descriptM;
    }

    @Basic
    @Column(name = "logo", nullable = true, length = 64)
    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    @Basic
    @Column(name = "is_auto_refund")
    public String getIsAutoRefund() {
        return isAutoRefund;
    }

    public void setIsAutoRefund(String isAutoRefund) {
        this.isAutoRefund = isAutoRefund;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GroupBuyingBaseEntity that = (GroupBuyingBaseEntity) o;

        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (startDatetime != null ? !startDatetime.equals(that.startDatetime) : that.startDatetime != null)
            return false;
        if (endDatetime != null ? !endDatetime.equals(that.endDatetime) : that.endDatetime != null) return false;
        if (duration != null ? !duration.equals(that.duration) : that.duration != null) return false;
        if (goodCode != null ? !goodCode.equals(that.goodCode) : that.goodCode != null) return false;
        if (numMember != null ? !numMember.equals(that.numMember) : that.numMember != null) return false;
        if (captainPrice != null ? !captainPrice.equals(that.captainPrice) : that.captainPrice != null) return false;
        if (teammatePrice != null ? !teammatePrice.equals(that.teammatePrice) : that.teammatePrice != null)
            return false;
        if (content != null ? !content.equals(that.content) : that.content != null) return false;
        if (descript != null ? !descript.equals(that.descript) : that.descript != null) return false;
        if (descriptM != null ? !descriptM.equals(that.descriptM) : that.descriptM != null) return false;
        if (logo != null ? !logo.equals(that.logo) : that.logo != null) return false;
        return isAutoRefund != null ? isAutoRefund.equals(that.isAutoRefund) : that.isAutoRefund == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (startDatetime != null ? startDatetime.hashCode() : 0);
        result = 31 * result + (endDatetime != null ? endDatetime.hashCode() : 0);
        result = 31 * result + (duration != null ? duration.hashCode() : 0);
        result = 31 * result + (goodCode != null ? goodCode.hashCode() : 0);
        result = 31 * result + (numMember != null ? numMember.hashCode() : 0);
        result = 31 * result + (captainPrice != null ? captainPrice.hashCode() : 0);
        result = 31 * result + (teammatePrice != null ? teammatePrice.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (descript != null ? descript.hashCode() : 0);
        result = 31 * result + (descriptM != null ? descriptM.hashCode() : 0);
        result = 31 * result + (logo != null ? logo.hashCode() : 0);
        result = 31 * result + (isAutoRefund != null ? isAutoRefund.hashCode() : 0);
        return result;
    }


    @Override
    public String toString() {
        return "GroupBuyingBaseEntity{" +
                "name='" + name + '\'' +
                ", code='" + code + '\'' +
                ", startDatetime=" + startDatetime +
                ", endDatetime=" + endDatetime +
                ", duration=" + duration +
                ", goodCode='" + goodCode + '\'' +
                ", numMember=" + numMember +
                ", captainPrice=" + captainPrice +
                ", teammatePrice=" + teammatePrice +
                ", content='" + content + '\'' +
                ", descript='" + descript + '\'' +
                ", descriptM='" + descriptM + '\'' +
                ", logo='" + logo + '\'' +
                ", isAutoRefund='" + isAutoRefund + '\'' +
                '}';
    }
}
